<div id="sidebar">

	<ul>

<?
	if(strlen(pageid) > 0) {
?>
		<li class="section_header"><? if(pageid == "trashheap") { echo "TrashHeap"; } else { echo ucwords(pageid); } ?></li>
<?
	}
	if(pageid == "dashboard") {
		if(function_exists(drizzo_trash_count)/* && (drizzo_trash_count() > 0)*/) {
			echo "<li><a href=\"trashheap.php\" title=\"View the TrashHeap\">TrashHeap (" . drizzo_trash_count() . ")</a></li>";
		}
	} elseif(pageid == "blog") {
?>
		<li<? if(!$_GET['action']) { echo " class=\"current\""; }?>><a href="blog.php">View Current Posts</a></li>

		<li<? if($_GET['action'] == "new") { echo " class=\"current\""; }?>><a href="blog.php?action=new">Write New Post</a></li>

		<li<? if($_GET['action'] == "view_drafts") { echo " class=\"current\""; }?>><a href="blog.php?action=view_drafts">Work on Drafts (<? echo drizzo_drafts_count("blog,aside"); ?>)</a></li>
<?
		} elseif(pageid == "pages") {
?>
	<li<? if(!$_GET['action']) { echo " class=\"current\""; }?>><a href="pages.php" title="View All Pages">View All Pages</a></li>

	<li<? if($_GET['action'] == "new") { echo " class=\"current\""; }?>><a href="pages.php?action=new">Write New Page</a></li>
	
	<li<? if($_GET['action'] == "view_drafts") { echo " class=\"current\""; }?>><a href="pages.php?action=view_drafts">Work on Drafts (<? echo drizzo_drafts_count("page"); ?>)</a></li>
<?
	} elseif(pageid == "comments") {
?>
	<li<? if(!$_GET['action']) { echo " class=\"current\""; } ?>><a href="comments.php">View Recent Comments</a></li>
	
	<li<?if($_GET['action'] == 'view_approved') { echo " class=\"current\""; }?>><a href="comments.php?action=view_approved">Approved Comments (<? echo drizzo_comments_count('approved'); ?>)</a></li>

	<li<?if($_GET['action'] == 'view_moderated') { echo " class=\"current\""; }?>><a href="comments.php?action=view_moderated">Moderated Comments (<? echo drizzo_comments_count('moderated'); ?>)</a></li>

	<li<?if($_GET['action'] == 'view_spam') { echo " class=\"current\""; }?>><a href="comments.php?action=view_spam">Spam Comments (<? echo drizzo_comments_count('spam'); ?>)</a></li>

	<li<?if($_GET['action'] == 'view_all') { echo " class=\"current\""; }?>><a href="comments.php?action=view_all">All Comments (<? echo drizzo_comments_count('all'); ?>)</a></li>
<?
	} elseif(pageid == "options") {
?>
		<li<? if(!$_GET['options']) { echo " class=\"current\""; } ?>><a href="options.php">General</a></li>

<?
		$options = array('modules','post','cache','warehouse','events','gallery','media','comments','theme');
		foreach($options as $option) {
?>
		<li<?if($_GET['options'] == $option) { echo " class=\"current\""; }?>><a href="options.php?options=<? echo $option?>"><? echo ucwords($option); ?></a></li>
<?
		}
	if(drizzo_theme_options($_POST['theme']) || (!$_POST && drizzo_theme_options(drizzo_global_options('theme')))) {
		$theme_meta = drizzo_theme_info();
?>
		<li<?if($_GET['options'] == 'theme_options') { echo " class=\"current\""; }?>><a href="options.php?options=theme_options"><? echo $theme_meta['theme']; ?> Theme Options</a></li>
	
<?
	}
?>
		<li<?if($_GET['options'] == 'miscellaneous') { echo " class=\"current\""; }?>><a href="options.php?options=miscellaneous">Miscellaneous</a></li>
<?
	} elseif(pageid == "trashheap") {
?>
	<li class="current"><a href="trashheap.php" title="View the TrashHeap">View the TrashHeap</a></li>
<?
	} elseif(pageid == "plugins") {
?>
	<li<? if(!$_GET['plugin']) { echo " class=\"current\""; } ?>><a href="plugins.php">View Available Plugins</a></li>

<?
		if(drizzo_plugins_with_interfaces()) {
			$plugins = drizzo_plugins_with_interfaces();
			foreach($plugins as $plugin) {
				$meta = drizzo_plugin_info($plugin);
				extract($meta);
?>
	<li<? if($_GET['plugin'] == $plugin) { echo " class=\"current\""; } ?>><a href="plugins.php?plugin=<? echo $plugin; ?>"><? echo $name; ?></a></li>
<?
			}
		}
	} elseif(pageid == 'users') {
?>
	<li<? if(!$_GET) { echo " class=\"current\""; } ?>><a href="users.php">View All Users</a></li>

	<li<? if($_GET['action'] == 'add_user') { echo " class=\"current\""; } ?>><a href="users.php?action=add_user">Add a User</a></li>

<? 
		if($_GET['delete']) {
?>
	<li class="current"><a>Delete a User</a></li>

<?
		} elseif($_GET['edit']) {
?>
	<li class="current"><a>Edit a User</a></li>
<?
		} elseif($_GET['user']) {
?>
	<li class="current"><a>User Profile</a></li>

<?
		}
	} elseif(pageid == 'podcasts') {
		
	} elseif(pageid == 'reviews') {
		
	} elseif(pageid == 'events') {
?>
	<li<? if(!$_GET['action'] || ($_GET['action'] && $_POST)) { echo " class=\"current\""; } ?>><a href="events.php">View All Events</a></li>
	<li<? if($_GET['action'] == 'add' && !$_POST) { echo " class=\"current\""; } ?>><a href="events.php?action=add">Add an Event</a></li>
<? 
		if($_GET['action'] == 'delete' && !$_POST) {
?>
	<li class="current"><a>Delete an Event</a></li>
<?
		} elseif($_GET['action'] == 'edit' && !$_POST) {
?>
	<li class="current"><a>Edit an Event</a></li>
<?
		}
	} elseif(pageid == 'gallery') {
?>
	<li<? if(!$_GET) { echo " class=\"current\""; } ?>><a href="gallery.php">View Gallery Items</a></li>

	<li><a href="media.php?action=add">Add an Image</a></li>

	<li><a href="media.php?list=gallery">Manage Image Files</a></li>
<?
		if(!$_POST && isset($_GET['action'])) {
?>
	<li class="current"><a href=""><? echo ucwords($_GET['action']); ?> an Image Post</a></li>
<?
		}
	} elseif(pageid == 'media') {
?>
	<li<? if(!$_GET['action']) { echo " class=\"current\""; } ?>><a href="media.php">View All Media</a></li>

	<li<? if($_GET['action'] == 'add') { echo " class=\"current\""; } ?>><a href="media.php?action=add">Add Media File</a></li>
<?
		if(!$_POST && $_GET['action'] != 'add' && isset($_GET['action'])) {
?>
	<li class="current"><a href=""><? echo ucwords($_GET['action']); ?> an Item</a></li>
<?
		}
	} elseif(pageid == 'links') {
?>
	<li<? if(!$_GET) { echo " class=\"current\""; } ?>><a href="links.php">View All Links</a></li>

	<li<? if(isset($_GET['user'])) { echo " class=\"current\""; } ?>><a href="links.php?user=">View Links by User</a></li>

	<li<? if($_GET['action'] == 'add') { echo " class=\"current\""; } ?>><a href="links.php?action=add">Add New Link</a></li>
<?
		if($_GET['edit']) {
?>
	<li class="current"><a>Edit a Link</a></li>
<?		
		}
	} elseif(pageid == 'warehouse') {
?>
	<li class="current"><a>Compare Revisions</a></li>
<?
	} elseif(pageid == 'help') {
		
	} else {
?>
	<li class="current"><a href="<? echo admin_folder; ?>" title="Please Login">Login</a></li>
<?
	}
?>
		<br class="clear" />

	</ul>
	
</div>

<div id="wrapper">
